//
//  AlipayMoudle.m
//  eCourseApp
//
//  Created by andrew on 2018/8/3.
//  Copyright © 2018年 Facebook. All rights reserved.
//

#import "AlipayMoudle.h"
#import <AlipaySDK/AlipaySDK.h>

@implementation AlipayMoudle

// 支付宝， 如果没安装支付宝客户端，会调到sdk内嵌的h5去支付
RCT_EXPORT_METHOD(payV2:(NSString *)orderInfo
                  resolver:(RCTPromiseResolveBlock)resolve
                  rejecter:(RCTPromiseRejectBlock)reject){
  //应用注册scheme,在AliSDKDemo-Info.plist定义URL types
  NSString *appScheme = @"Alipay";
  
  [[AlipaySDK defaultService] payOrder:orderInfo fromScheme:appScheme callback:^(NSDictionary *resultDic) {
//    resolve(resultDic);
    
    NSLog(@"reslut = %@",resultDic);
  }];
}




RCT_EXPORT_METHOD(showPackageName:(NSString *)msg
                  resolver:(RCTPromiseResolveBlock)resolve
                  rejecter:(RCTPromiseRejectBlock)reject){
  resolve(msg);
}



RCT_EXPORT_MODULE(Alipay);

@end
